<?php


namespace app\admin\controller;
use app\BaseController;
use app\Request;

/**
 * 获取请求参数的5种方式
 */
class Req extends BaseController
{

    public function test1(){
        //dump($this->request);

        //默认11, 自动转变为整数
        dump($this->request->param('age', 11, 'intval'));
    }

    public function test2(Request $request){
        dump($request->param('age'));
    }

    public function test3(){
        dump(input('age'));
    }

    public function test4(){
        dump(\request()->param('age'));
    }

    public function test5(){
        dump(\think\facade\Request::param('age'));
    }

}